package uestc.bitman.edxapp.misc;

import uestc.bitman.edxapp.EdxApp;
import uestc.bitman.edxapp.EdxStudentUser;

import android.os.AsyncTask;

public class ChangeEnrollmentAsyncTask extends AsyncTask<ChangeEnrollmentParameters, Void, Boolean> {

    ChangeEnrollmentParameters parameters;
    
    @Override
    protected Boolean doInBackground(ChangeEnrollmentParameters... params) {
        parameters = params[0];
        EdxStudentUser user = EdxApp.getEdxAppUser();
        return user.changeEnrollment(parameters.getCourseId(),
                parameters.getAction());
    }

    protected void onPostExecute(Boolean result) {
        parameters.onPostExecute(result);
    }
}
